<%--
 *  File:    AgreementPropertySummary.jsp
 *  @Author: Dcdai
 *  Date:    2011-08-05

 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.OvalLabel" %>
<%@ page import="com.oval.util.OvalCustomMessage" %>
<%@ page import="com.oval.util.OvalCustomColumn" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  String privilegeCode = "ALL";
  String strTableName = "v_zmylagreementproperty";
  String strModuleName = "ALL";
  HashMap userinfo = new HashMap();
  userinfo = (HashMap)session.getAttribute("userinfo");
  Integer neworgid=new Integer(-1);
  if(userinfo.get("orgid")!=null)
  neworgid = (Integer)userinfo.get("orgid");

%>




<%@ include file="/inc/PageDefault.inc" %>
<%@include file="/inc/Print.inc"%>
<%@ include file="/inc/FrmDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>ActionSummary</title>
<PageFlow:CheckPageFlow pageName="p_zmylagreementpropertyforsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>
function clickProd(id,num)
{
  document.actionsummaryform.chooseactionid.value = id;
  document.actionsummaryform.chooseindexnum.value = num;
}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(actionsummaryform,actionvalue,orderbyname);
  editform.action = "AgreementPropertyForSummary.jsp?<%= OvalTools.randomURL() %>&selectopt=all";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function openAll(t){
	if(t.checked)
	{
		document.actionsummaryform.needprod.disabled=false;
		document.actionsummaryform.contenttype.disabled=false;
	}else{
		document.actionsummaryform.needprod.checked=false;
		document.actionsummaryform.needprod.disabled=true;
		document.actionsummaryform.contenttype.value="-1";
		document.actionsummaryform.contenttype.disabled=true;
		document.actionsummaryform.sourcetype.value="-1";
		document.actionsummaryform.sourcetype.disabled=true;
	}
}
function openActionsource(){
var op = document.actionsummaryform.contenttype.value;
    
    if(op==-1){
        document.actionsummaryform.needprod.disabled=true;
        document.actionsummaryform.needprod.checked=false;

    }else{
        document.actionsummaryform.needprod.disabled=false;
        document.actionsummaryform.needprod.checked=false;
     }
     if(op==4)
        {
            document.actionsummaryform.sourcetype.disabled=false;


        }else{
                document.actionsummaryform.sourcetype.value="-1";
                document.actionsummaryform.sourcetype.disabled=true;

        }

}

function page_add(){
   
  var agreementpropertycode = document.actionsummaryform.agreementpropertycode.value;
  if(agreementpropertycode=="" || agreementpropertycode==-1)
  {
    alert("<%= message.getMessageDesc("MUST_INPUT_FIRST",label.getLabelName("L_actionguidecode"))%>");
    return;
  }

    var agreementpropertyname = document.actionsummaryform.agreementpropertyname.value;
  if(agreementpropertyname=="" || agreementpropertyname==-1)
  {
    alert("<%= message.getMessageDesc("MUST_INPUT_FIRST",label.getLabelName("L_actionguidename"))%>");
    return;
  }

/*	if(document.actionsummaryform.newneedfeedback.checked)
	{*/
		    var contenttype = document.actionsummaryform.contenttype.value;
 			 if(contenttype=="" || contenttype==-1)
  			{
   				 alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_feedbackdatatype"))%>");
    				return;
  			}
	/*}*/

	var op = document.actionsummaryform.contenttype.value;
	if(op==4)
	{
	 	var sourcetype = document.actionsummaryform.sourcetype.value;
		  if(sourcetype=="" || sourcetype==-1)
 		 {
    		alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_sourcetype"))%>");
    		return;
  		}
	}
 var frm = document.actionsummaryform;
   frm.actionname.value = "add";
   frm.target = "_self";
   isRunning = true;
   frm.submit();
}

function page_delete(){
	if(document.actionsummaryform.chooseactionid!=null&&document.actionsummaryform.chooseactionid.value!="")
	{
		document.actionsummaryform.delzmylagreementpropertyid.value = document.actionsummaryform.chooseactionid.value
		  var flag = confirm('<%=message.getMessageDesc("ARE_YOU_SURE_DEL")%>');
  			if(!flag)
    		return;
    		 var frm = document.actionsummaryform;
   frm.actionname.value = "delete";
   frm.target = "_self";
   isRunning = true;
   frm.submit();

	}

}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 <form name="actionsummaryform" method="post" action="../../Dispatcher">
      <input type="hidden" name="pagename" value="p_zmylagreementpropertyforsummary">
      	<input type="hidden" name="actionname">
      	 <%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td>
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td class="summary_top" colspan="2" ></td>
        </tr>
	<%@ include file="/inc/SummarySearch.inc" %>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">

        <tr class="deepblue-left">
          <td width="5%" class="title_center">&nbsp;</td>
          <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','agreementpropertycode')"><%= label.getLabelName("L_ConfigCode") %></a></td>
          <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','agreementpropertyname')"><%= label.getLabelName("L_ConfigName") %></a></td>
          <td width="20%" class="title_center"><a href="javascript:page_summary('orderby','description')"><%= label.getLabelName("L_Description") %></a></td>
          <td width="6%" class="title_center"><a href="javascript:page_summary('orderby','valuename')"><%= label.getLabelName("L_ConfigType") %></a></td>
          <td width="6%" class="title_center"><a href="javascript:page_summary('orderby','sourcetype')"><%= label.getLabelName("L_sourcetype ") %></a></td>
          <td width="6%" class="title_center"><a href="javascript:page_summary('orderby','needprod')"><%= label.getLabelName("L_YorN") + label.getLabelName("L_MoneyCent") + label.getLabelName("L_Product")    %></a></td>
          <td width="25%" class="title_center"><a href="javascript:page_summary('orderby','sqldesc')"><%= label.getLabelName("L_SQL ") %></a></td>
        </tr>
        <%int i=0; %>
            <%
                        Vector totalsummary = (Vector) pageContext.getAttribute("totalsummary");
                        if (totalsummary == null)
                            totalsummary = new Vector();
                       Vector actionsourcecollection = (Vector) pageContext.getAttribute("actionsourcecollection");
                        if (actionsourcecollection == null)
                            actionsourcecollection = new Vector();
                            boolean bHasChecked = false;
                             String strClassType = new String("");

               %>
	 <logic:iterate id="actionhash" collection="<%=totalsummary%>" indexId="orderid">
	 <%
	 String strIsChecked ="";
	 		            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
	      if(!bHasChecked)
            {
              strIsChecked = "checked";
              bHasChecked = true; %>
         <input type="hidden" name="chooseactionid"  id="chooseactionid" value="<custom:write property="zmylagreementpropertyid" name="actionhash" nbsp="true"/>">
          <input type="hidden" name="chooseindexnum"  id="chooseindexnum" value="<%=JspHelper.filterNull(i+1)%>">
            <%   }
              i++;
	 %>
	 <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('action<%=JspHelper.filterNull(i)%>');clickProd('<custom:write property="zmylagreementpropertyid" name="actionhash"/>','<%=JspHelper.filterNull(i)%>');" class="<%=JspHelper.filterNull( strClassType )%>" >
	 <td>
	 <input id="action<%=JspHelper.filterNull(i)%>" type="radio"  name="oneagreementpropertyid" value="<custom:write property="zmylagreementpropertyid" name="actionhash"/>"
	 onClick="javascript:clickProd('<custom:write property="zmylagreementpropertyid" name="actionhash" nbsp="true"/>','<%=JspHelper.filterNull(i)%>')" Class="normalradio" <%=strIsChecked%>/>
	 </td>
	 <td><custom:write property="agreementpropertycode" name="actionhash" nbsp="true" /></td>
	 <td><custom:write property="agreementpropertyname" name="actionhash" nbsp="true" /></td>
	 <td><custom:write property="description" name="actionhash" nbsp="true" /></td>
	 <td><custom:write property="valuename" name="actionhash" nbsp="true" /></td>
	 <td><custom:write property="sourcetype" name="actionhash" nbsp="true" /></td>
	 <td class="title_center"><custom:write property="needprod" name="actionhash" nbsp="true" /></td>
	 <td><custom:write property="sqldesc" name="actionhash" nbsp="true" /></td>
	 </tr>
	 </logic:iterate>
	 <tr>
	 <td>&nbsp;</td>
	 <td><input type="text" name="agreementpropertycode" maxlength="12" style="width:100"/>&nbsp;<font color="red"><%= label.getLabelName("L_Asterisk") %></font></td>
	 <td><input type="text" name="agreementpropertyname" maxlength="16" style="width:100"/>&nbsp;<font color="red"><%= label.getLabelName("L_Asterisk") %></font></td>
	 <td><input type="text" name="description" maxlength="64" style="width:120"/></td>

	 <td><custom:selectdic property="contenttype"  dictType="AgreementContentType"   defaultValue="--------" valueCriteria="1,2,3,4,6,7"   style="width:90"   onchange="openActionsource();"/></td>
	 
	 <td>
	 <custom:select defaultValue="--------" property="sourcetype" optionsName="totalsummary" optionValueKey="zmylagreementpropertyid" optionInnerTextKey="agreementpropertycode" style="width:70" />
	 </td>
	 
	 <td class="title_center"><input type="checkbox" Class="normalradio" name="needprod" value="Y" disabled/></td>
	 <td><input type="text"  name="sqldesc"  maxlength="12" style="width:350"/>&nbsp;<font color="red"><%= label.getLabelName("L_Asterisk") %></font></td>
	 </tr>
	          <%@ include file="/inc/SummaryAction.inc" %>
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top" ></td>
        </tr>
        <tr>
          <td class="td_center">
          <input type="hidden" name="neworgid" value="<%=neworgid%>">
          <input type="hidden" name="delzmylagreementpropertyid">
          <a onclick="page_add();"><custom:button type="1" label="L_Add" imgsrc="new.gif" border="0" style="width:60"/></a>
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
 </form>
</body>
</html>